Quantcast
Jump to content


Recommended Posts

Posted

Whenever necessary, you can create, build, register, and submit newer versions of your Galaxy Watch app for publication in Galaxy Store. You can update apps that you created using Galaxy Watch Designer or Tizen Studio.

Note: All statements below apply to apps developed using either Galaxy Watch Designer or Tizen Studio, except for the Tizen Studio step 4 in the procedure below.

Upon updating the app in Seller Portal, a new update registration is created, which you complete and submit for review processing. During registration and review processing, the previous version continues to be published in Galaxy Store.

For an updated version:

  • The filename must be different from all previous version filenames.

  • The package ID must be the same as for the first app version.

  • The app version number must be greater than the previous version number.

  • The author certificate must be the same as for the first app version.

    Caution: Without the app’s author certificate, you cannot update the app. We recommend that you store multiple backup copies somewhere other than on your development computer.

To create, build, register, and submit an updated app version

  1. Get the author certificate of the app.

  2. Get the filename, package ID, and version number (version name) of the current app version in Seller Portal:
    a. Click Applications, and navigate to and click [your published app title].
    b. Click the Binary tab and [your latest binary filename].

    Binary_GWUpdateApp-blog.png

  3. In Galaxy Watch Designer:
    a. Back up your project and save it in a different directory.
    b. Create the new app version.
    c. Click Project > Build. Then specify the same package ID and a different version number, use the same author certificate, and build the updated binary file(s) (.tpk).
    d. Rename the resulting binary files, and keep them in the same workspace directory.

  4. In Tizen Studio:
    a. Open either your app’s Tizen project tizen-manifest.xml file (Native) or config.xml file (Web).
    b. In the Overview tab, specify the update version number in the Version field.
    c. Use the certificate manager to ensure you have a certificate profile that contains your app’s author certificate.

    Note: You do not need to use the same certificate profile, just the same author certificate. You can re-use an author certificate across multiple certificate profiles.

    d. Build a signed package for your app.
    e. In the console, note the output location of the compiled .tpk (Native) or .wgt (Web) update binary file, and rename if necessary.

  5. In Seller Portal: a. Click Applications, navigate to your published app, and click Update. b. Register the update version information and upload the updated binary files. c. Deselect any unsupported distribution device groups. d. Submit the update version for review processing by clicking Submit.

If the update version does not pass review processing, the Samsung review team will notify you. You can then change the update version, upload the changed update binary file, and submit the update version again.

If your update version passes review processing, the previous version will stop being published in Galaxy Store, and the updated version will start being published. You can then manage the latest version and your finances in Seller Portal.

View the full blog at its source



  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Similar Topics

    • By Samsung Newsroom
      Samsung Wallet provides powerful tools for partners to engage with their users and improve the user experience. Push notification is one of these features, allowing partners to send customized notifications to their users. But before they can do that, partners need to create a notification template and receive approval for it from Samsung.
      Partners can create individual notification templates from the Wallet Partners Portal. As a partner, if you need to create a large number of card notifications, the Adding Notification Templates server API comes in handy.
      In the example scenario in this blog, we create a notification template from a partner's server using the Adding Notification Template API.
      System requirements
      The Adding Notification Template API has the following prerequisites:
      Complete the onboarding procedure to obtain the required security certificates if you are new to Samsung Wallet, and create your wallet card.
      Get permission from Samsung to use the Adding Notification Template API as explicit permission is needed. Reach out to Samsung Developer Support for further assistance.
      API fundamentals
      To create a notification template, you need to handle an HTTP POST request which contains the endpoint, headers, and a body. For a successful execution of the API, you need to follow the following specification.
      Endpoint: Use the following URL as endpoint.
      URL https://tsapi-card.walletsvc.samsung.com/partner/v1/card/template/{Card Id}/notification Headers: To ensure secure communication between the Samsung server and the partner server, implement the following headers.
      Authorization: Bearer token for authentication. For details, follow REST API Authorization Token. x-smcs-partner-id: Use the Samsung Wallet partner ID. x-request-id: A unique UUID string that identifies each request. Body: Contains detailed template data in the JWT token format. See the Adding Notification Templates for a detailed API specification.
      API implementation
      The steps below show how to implement the Adding Notification Template API. For a better understanding of the implementation process, download the sample source code.
      Certificate management
      The KeyManager class is a static utility class that provides methods for loading cryptographic keys from files. This separation of concerns ensures that certificate handling logic is isolated and reusable.
      Loading public keys from certificate files
      First, you need to load RSA public certificates from X.509 certificate files. The GetPublicKeyRSA() method loads RSA public keys from the partner.crt and samsung.crt files you received during the onboarding process. If the certificate doesn't contain an RSA key, this method raises an exception.
      public static RSA GetPublicKeyRSA(string certPath) { try { var cert = new X509Certificate2(certPath); return cert.GetRSAPublicKey() ?? throw new InvalidOperationException("Certificate does not contain RSA public key"); } catch (Exception ex) { throw new InvalidOperationException($"Failed to load certificate: {ex.Message}", ex); } } Loading private keys from a PEM file
      The GetPrivateKeyRSA() method loads an RSA private key from a PEM file. This is used to generate JWT tokens.
      public static RSA GetPrivateKeyRSA(string pemPath) { try { string keyData = File.ReadAllText(pemPath); // Remove PEM headers and whitespace keyData = keyData.Replace("-----BEGIN PRIVATE KEY-----", "") .Replace("-----END PRIVATE KEY-----", "") .Replace("-----BEGIN RSA PRIVATE KEY-----", "") .Replace("-----END RSA PRIVATE KEY-----", "") .Replace("\n", "") .Replace("\r", "") .Trim(); byte[] keyBytes = Convert.FromBase64String(keyData); var rsa = RSA.Create(); rsa.ImportPkcs8PrivateKey(keyBytes, out _); return rsa; } catch (Exception ex) { Console.WriteLine($"Failed to load private key from {pemPath}: {ex.Message}"); return null; } } Token generation
      The TokenGenerator class is the heart of the implementation, responsible for creating secure tokens using cryptographic techniques.
      Constructor and properties
      The class stores all necessary cryptographic keys and identifiers.
      private string _partnerId = ""; private string _certificateId = ""; private readonly RSA _samsungPublicKey; private readonly RSA _partnerPublicKey; private readonly RSA _partnerPrivateKey; public TokenGenerator(string partnerId, string certificateId, RSA samsungPublicKey, RSA partnerPublicKey, RSA partnerPrivateKey) { _partnerId = partnerId; _certificateId = certificateId; _samsungPublicKey = samsungPublicKey; _partnerPublicKey = partnerPublicKey; _partnerPrivateKey = partnerPrivateKey; } Generating an authentication token
      An authentication token proves that your request to Samsung's server is legitimate. It contains the following:
      The API method and path being accessed. var authPayload = new Dictionary<string, object> { ["API"] = new Dictionary<string, string> { ["method"] = "POST", ["path"] = $"/partner/v1/card/template/{cardId}/notification" } }; Timestamp and other metadata like certificate id. Retrieve this metadata from My account > Encryption Management in the Wallet Partners Portal.
      A digital signature that verifies the sender's identity. The token is used in the Authorization header of the HTTP request.
      public string GenerateAuthToken(Dictionary<string, object> authPayload, string contentType_auth) { string dataStr = JsonSerializer.Serialize(authPayload); string authToken = SignJws(dataStr, contentType_auth); return authToken; } Generating a notification template token
      Next, generate the JWT token for notification template data (ntemplate). It is recommended to generate this token after a user action. For details about the JWT format, follow Card Data Token (cdata).
      Preparing a notification template
      Define the notification template according to the following code snippet. Define your message details and message type here. Get details about the template fields from the “[Request]” section of the Adding Notification Templates documentation.
      var notificationTemplate = new { type = "M", messageType = "M", messageDetails = new[] { new { languageCode = "en", message = "Sample merchant push notification message." } }, forceSaveYn = "N" }; NoteUse forceSaveYn = “Y”, if you want to save the template even if the message is detected as harmful. If your message is detected as harmful, your template can be rejected by Samsung. The default value of the forceSaveYn property is “N”. Implementing encryption (JWE)
      The notification template data or payload is encrypted using the Samsung public key and this encrypted payload is used for signing.
      public string GenerateCdata(string payloadData, string notification) { string jweTokenString = JWT.Encode(payloadData, _samsungPublicKey, JweAlgorithm.RSA1_5, JweEncryption.A128GCM); string jwtTokenString = SignJws(jweTokenString, notification); return jwtTokenString; } Implementing JWS signing
      The encrypted JWE token is then signed with the partner's private key. This signature proves the token originated from a legitimate partner. Samsung can verify this signature using the partner's public key.
      NoteUse AUTH as the content type when signing an auth token and use NOTIFICATION as the content type when signing the notification template data. private string SignJws(string payload, string contentType) { try { // Create header var header = new Dictionary<string, object> { ["alg"] = "RS256", ["cty"] = contentType, ["partnerId"] = _partnerId, ["ver"] = 3, ["certificateId"] = _certificateId, ["utc"] = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }; return JWT.Encode(payload, _partnerPrivateKey, JwsAlgorithm.RS256, header); } catch (Exception ex) { throw new InvalidOperationException($"JWS signing failed: {ex.Message}", ex); } } Building and executing the POST request
      The next stage of the process is to construct the HTTP POST request to generate a new notification.
      client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Authorization", $"Bearer {authToken}"); client.DefaultRequestHeaders.Add("x-smcs-partner-id", partnerId); client.DefaultRequestHeaders.Add("x-request-id", requestId); try { HttpResponseMessage response = await client.PostAsync(endpoint, content); response.EnsureSuccessStatusCode(); string responseContent = await response.Content.ReadAsStringAsync(); Console.WriteLine("Successfully generated notification template: " + responseContent); } catch (HttpRequestException e) { Console.WriteLine("Failed to generate notification template: " + e.Message); } catch (Exception e) { Console.WriteLine("Unexpected error during HTTP request: " + e.Message); } Running the sample application
      Once you are done with the above steps, open the sample project and do the following:
      Update the partnerId, cardId, and certificateId values in the src/Program.cs file with your actual values. Place your partner.crt, samsung.crt and private_key.pem files in the /cert directory. Navigate to the src directory, then build and run the project. Find the details for responses and errors from the [Response] section of the documentation. # Build the project dotnet build # Run the application dotnet run Conclusion
      Now that you know how to create a new notification template using the Adding Notification Template API, you can implement it with your server if you need to generate a larger number of notification templates at once.
      Additional resources
      For more information on this topic, consult the following resources:
      Download the complete source code Official Samsung Wallet API documentation Send Push Notifications to Samsung Wallet Users Using the Send Notification API blog View the full blog at its source
    • By Samsung Newsroom
      Samsung Wallet Partners can create and update card templates to meet their business needs through the Wallet Partners Portal. However, if the partner has a large number of cards, it can become difficult to manage them using the Wallet Partners Portal website. To provide partners with more flexibility, Samsung provides server APIs so that partners can easily create and modify Samsung Wallet card templates without using the Wallet Partners Portal. With these APIs, partners can also create their own user interface (UI) or dashboard to manage their cards.
      In this article, we implement the Add Wallet Card Templates API to create a card template for a Coupon in the Wallet Partners Portal. We focus on the API implementation only and do not create a UI for card management.
      Prerequisites
      If you are new to Samsung Wallet, complete the onboarding process and get the necessary certificates. As a Samsung Wallet Partner, you need permission to use this API. Only authorized partners are allowed to create wallet card templates using this API. You can reach out to Samsung Developer Support for further assistance. API overview
      The REST API discussed in this article provides an interface to add wallet card templates directly from the partner's server. This API utilizes a base URL, specific headers, and a well-structured body to ensure seamless integration.
      URL: This is the endpoint where the request is sent to create a new wallet card template.
      https://tsapi-card.walletsvc.samsung.com/partner/v1/card/template Headers: The information provided in the headers ensures secure communication between the partner's server and Samsung's server.
      Authorization: The Bearer token. See the JSON Web Token documentation for details. X-smcs-partner-id: This is your partner ID. The partner ID gives you permission to use the API. X-request-id: Use a randomly generated UUID string in this field. Body: The body must be in the JWT token format. Convert the payload data (card template in JSON format) into a JWT token.
      For more details about the API, refer to the documentation.
      Implementation of the API to create a card template
      The Add Wallet Card Templates API allows you to add a new card template to the Wallet Partners Portal. You can also create the card in the portal directly, but this API generates a new card template from your server, without requiring you to launch the Wallet Partners Portal. Follow these steps to add a new card template.
      Step 1: Extracting the keys
      Extract the following keys from the certificates. These keys are used while generating the JWT token.
      RSAPublicKey partnerPublicKey = (RSAPublicKey) readPublicKey("partner.crt"); RSAPublicKey samsungPublicKey = (RSAPublicKey) readPublicKey("samsung.crt"); PrivateKey partnerPrivateKey = readPrivateKey("private_key.pem"); Extracting the public keys
      Use the following code to extract the partner public key and the Samsung public key from the partner.crt and samsung.crt certificate files, respectively. You received these certificate files during the onboarding process.
      private static PublicKey readPublicKey(String fileName) throws Exception { // Load the certificate file from resources ClassPathResource resource = new ClassPathResource(fileName); try (InputStream in = resource.getInputStream()) { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); X509Certificate certificate = (X509Certificate) certFactory.generateCertificate(in); return certificate.getPublicKey(); } } Extracting the private key
      The following code extracts the private key from the .pem file you generated during the onboarding process. This key is needed to build the auth token.
      private static PrivateKey readPrivateKey(String fileName) throws Exception { String key = new String(Files.readAllBytes(new ClassPathResource(fileName).getFile().toPath())); key = key.replace("-----BEGIN PRIVATE KEY-----", "").replace("-----END PRIVATE KEY-----", "").replaceAll("\\s", ""); byte[] keyBytes = Base64.getDecoder().decode(key); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); return keyFactory.generatePrivate(new PKCS8EncodedKeySpec(keyBytes)); } Step 2: Generating the authorization token
      Samsung's server checks the authorization token of the API request to ensure the request is from an authorized partner. The authorization token is in the JWT format. Follow these steps to create an authorization token:
      Building the auth header
      Create an authHeader. Set “AUTH” as its payload content type to mark it as an authorization token. As you can create multiple certificates, use the corresponding certificate ID of the certificate that you use in the project. You can get the certificate ID from “My account > Encryption Management” of the Wallet Partners Portal.
      // create auth header JSONObject authHeader = new JSONObject(); authHeader.put("cty", "AUTH"); authHeader.put("ver", 3); authHeader.put("certificateId", certificateId); authHeader.put("partnerId", partnerId); authHeader.put("utc", utcTimestamp); authHeader.put("alg", "RS256"); Creating the payload
      Create the payload using the authHeader. Follow this code snippet to create the payload.
      // create auth payload JSONObject authPayload = new JSONObject(); authPayload.put("API", new JSONObject().put("method", "POST").put("path", "/partner/v1/card/template")); authPayload.put("refId", UUID.randomUUID().toString()); Building the auth token
      Finally, generate the authorization token. For more details, refer to the “Authorization Token” section of the Security page
      private static String generateAuthToken(String partnerId, String certificateId, long utcTimestamp, PrivateKey privateKey) throws Exception { // create auth header // create auth payload // return auth token return Jwts.builder() .setHeader(authHeader.toMap()) .setPayload(authPayload.toString()) .signWith(privateKey, SignatureAlgorithm.RS256) .compact(); } Step 3: Generating a payload object token
      The request body contains a parameter named “ctemplate” which is a JWT token. Follow these steps to create the “ctemplate.”
      Creating the card template object
      Select the proper card template you want to create from the Card Specs documentation. Get the payload object as JSON format. Now create the JSONObject from the JSON file using the following code snippet.
      // creating card template object JSONObject cDataPayload = new JSONObject(); cDataPayload.put("cardTemplate", new JSONObject() .put("prtnrId", partnerId) .put("title", "Sample Card") .put("countryCode", "KR") .put("cardType", "coupon") .put("subType", "others") .put("saveInServerYn", "Y")); Generating the JWE token
      Create the JWE token using the following code snippet. For more details about the JWE format, refer to the “Card Data Token” section of the Security page.
      // JWE payload generation EncryptionMethod jweEnc = EncryptionMethod.A128GCM; JWEAlgorithm jweAlg = JWEAlgorithm.RSA1_5; JWEHeader jweHeader = new JWEHeader.Builder(jweAlg, jweEnc).build(); RSAEncrypter encryptor = new RSAEncrypter((RSAPublicKey) samsungPublicKey); JWEObject jwe = new JWEObject(jweHeader, new Payload(String.valueOf(cDataPayload))); try { jwe.encrypt(encryptor); } catch (JOSEException e) { e.printStackTrace(); } String payload = jwe.serialize(); Building the JWS header
      Next, follow this code snippet to build the JWS header. Set “CARD” as the payload content type in this header.
      // JWS Header JWSHeader jwsHeader = new JWSHeader.Builder(JWSAlgorithm.RS256) .contentType("CARD") .customParam("partnerId", partnerId) .customParam("ver", 3) .customParam("certificateId", certificateId) .customParam("utc", utcTimestamp) .build(); Building the JWS token
      Generate the JWS token from the previously generated JWE token and, finally, get the “ctemplate” JWT. Follow the “JWS Format” section of the Security page.
      private static String generateCDataToken(String partnerId, PublicKey partnerPublicKey, PublicKey samsungPublicKey, PrivateKey partnerPrivateKey, String certificateId, long utcTimestamp) throws Exception { // creating card template object // JWE payload generation // JWS Header // JWS Token generation JWSObject jwsObj = new JWSObject(jwsHeader, new Payload(payload)); RSAKey rsaJWK = new RSAKey.Builder((RSAPublicKey) partnerPublicKey) .privateKey(partnerPrivateKey) .build(); JWSSigner signer = new RSASSASigner( ); jwsObj.sign(signer); return jwsObj.serialize(); } Step 4: Building the request
      As all of the required fields to create the request have been generated, you can now create the request to add a new template. Follow the code snippet to generate the request.
      private static Request buildRequest(String endpoint, String partnerId, String requestId, String authToken, String cDataToken) { // Prepare JSON body JSONObject cDataJsonBody = new JSONObject(); cDataJsonBody.put("ctemplate", cDataToken); RequestBody requestBody = RequestBody.create( MediaType.parse("application/json; charset=utf-8"), cDataJsonBody.toString() ); // Build HTTP Request Request request = new Request.Builder() .url(endpoint) .post(requestBody) .addHeader("Authorization", "Bearer " + authToken) .addHeader("x-smcs-partner-id", partnerId) .addHeader("x-request-id", requestId) .addHeader("x-smcs-cc2", "KR") .addHeader("Content-Type", "application/json") .build(); return request; } Step 5: Executing the request
      If the request is successful, a new card is added to the Wallet Partners Portal and its “cardId” value is returned as a response.
      private static void executeRequest(Request request) { // Execute HTTP Request try (Response response = client.newCall(request).execute()) { if (response.isSuccessful()) { System.out.println("Wallet Card Template added successfully: " + response.body().string()); } else { System.out.println("Failed to add Wallet Card Template: " + response.body().string()); } } } Implement as a server
      At this point, you can add a webpage UI for creating card templates and deploy it as a web service. In this sample project, there is no UI added. But, you can deploy this sample as a web service and test it.
      Conclusion
      This tutorial shows you how you can create a new Samsung Wallet card template directly from your server by using a REST API. Now that you can implement the API, you can add a UI and make it more user-friendly. Also implement the Updating Wallet Cards Templates API for better card management.
      References
      For additional information on this topic, refer to the resources below:
      Sample project code. Business Support for Special Purposes documentation. View the full blog at its source
    • By Samsung Newsroom
      On Galaxy Watch, Complications are small bits of useful information other than time, such as battery level, calendar events, or step count. These details are displayed in predefined areas called Complication Slots. You can set up different Complication Slots on your watch face using Watch Face Studio to customize the kind of information you want to display. The actual data used to populate these slots comes from other applications, known as Complication Data Sources.
      In this blog, we’ll explore building a Complication Data Source that allows your application to seamlessly share information with any compatible watch face on your Galaxy Watch running Wear OS powered by Samsung. Whether it is weather forecast, battery status or custom application stats, you'll learn how to deliver that data in a way that watch faces can easily access and display.
      Prerequisite
      Install the latest version of Android Studio. Download the starting project: starting_project_complication.zip Set up an emulator or connect your Galaxy Watch to your PC using Wireless Debugging. NoteThis blog requires you to have a basic understanding of native Android application development in Java or Kotlin. Run the starting project once to make sure everything is working as expected. This installs a sample application named Hydration Tracker. With it, you can log how many glasses of water you have had during the day and set a daily goal to stay on track. You will use this simple application to explore how you can share your data with a watch face. The project already includes all the required dependencies and core application logic, so you can jump straight into working on the data-sharing aspect.


      Figure 1: Sample application screenshot



      All the required data is stored in SharedPreferences as key-value pairs, which makes it easy to retrieve when building the Complication Data Source. Alternatively, you can use Jetpack DataStore if you prefer a more modern and scalable solution for managing application data.
      Implement Complication Data Source Service
      The complication needs data even when your application is not running. The way we do that is by implementing a Service that provides the data to the complication.
      Extract the starting project and open the starting_project_complication folder in Android Studio. Right-click on the java directory and add a new package named com.example.customcomplication.complication.
      Figure 2: Package structure



      Right-click on the complication package and select New > Kotlin Class/File. Name the class something like HydrationComplicationService.

      Figure 3: Creating the service class



      Extend that class with SuspendingComplicationDataSourceService(). Hover the cursor over it and import the class.

      Figure 4: Extending the service class



      Now implement all the members in the HydrationComplicationService class.

      Figure 5: Implementing members of the service class



      Afterwards, the class should look like this:
      class HydrationComplicationService : SuspendingComplicationDataSourceService() { override fun getPreviewData(type: ComplicationType): ComplicationData? { TODO("Not yet implemented") } override suspend fun onComplicationRequest(request: ComplicationRequest): ComplicationData? { TODO("Not yet implemented") } } The getPreviewData() method shows predefined data when your complication is loading the values and the onComplicationRequest() method is called whenever a complication data update is requested.
      Below the onComplicationRequest() method, add a createRangedValueComplicationData() method that returns a RangedValueComplicationData object. This method sets the minimum, maximum, and current values of the progress bar shown in the complication and sets the text that is shown. private fun createRangedValueComplicationData( current: Float, max: Float, text: String, contentDescription: String ): ComplicationData { return RangedValueComplicationData.Builder( value = current, min = 0f, max = max, contentDescription = PlainComplicationText.Builder(contentDescription).build() ) .setText(PlainComplicationText.Builder(text).build()) .build() } NoteIf you notice any class names highlighted in red, make sure to import the necessary classes. Next, create a MonochromaticImage inside the method you just created. It is used to set an optional image associated with the complication data. val monochromaticImage = MonochromaticImage.Builder( Icon.createWithResource(this, R.drawable.drinking_water_icon) ).build() Create a PendingIntent to launch the MainActivity from the complication when you tap on it. val pendingIntent = PendingIntent.getActivity( this, 0, Intent(this, MainActivity::class.java), PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT ) Now, on the RangedValueComplicationData, set monochromaticImage and tapAction before building it. return RangedValueComplicationData.Builder( value = current, min = 0f, max = max, contentDescription = PlainComplicationText.Builder(contentDescription).build() ) .setText(PlainComplicationText.Builder(text).build()) .setTapAction(pendingIntent) .setMonochromaticImage(monochromaticImage) .build() Finally, the method should look like this:
      private fun createRangedValueComplicationData( current: Float, max: Float, text: String, contentDescription: String ): ComplicationData { val monochromaticImage = MonochromaticImage.Builder( Icon.createWithResource(this, R.drawable.drinking_water_icon) ).build() val pendingIntent = PendingIntent.getActivity( this, 0, Intent(this, MainActivity::class.java), PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT ) return RangedValueComplicationData.Builder( value = current, min = 0f, max = max, contentDescription = PlainComplicationText.Builder(contentDescription).build() ) .setText(PlainComplicationText.Builder(text).build()) .setTapAction(pendingIntent) .setMonochromaticImage(monochromaticImage) .build() } Override the getPreviewData() method and use this new method to return a ComplicationData object. override fun getPreviewData(type: ComplicationType): ComplicationData? { if (type != ComplicationType.RANGED_VALUE) { return null } return createRangedValueComplicationData( current = 0f, max = 8f, text = "0 out of 8", contentDescription = "You've had 0 out of 8 glasses of water" ) } Override the onComplicationRequest() method as well. You are fetching the data from SharedPreferences because the starting project also saved the data in SharedPreferences. override suspend fun onComplicationRequest(request: ComplicationRequest): ComplicationData { val prefs = this.getSharedPreferences("water_prefs", Context.MODE_PRIVATE) val glassCount = prefs.getInt("glasses_drank", 0).toFloat() val maxGlasses = prefs.getInt("max_glasses", 8).toFloat() val text = "${glassCount.toInt()} out of ${maxGlasses.toInt()}" val contentDescription = "You've had ${glassCount.toInt()} out of ${maxGlasses.toInt()} glasses of water" return createRangedValueComplicationData( current = glassCount, max = maxGlasses, text = text, contentDescription = contentDescription ) } Register the Service
      To let the system know that your service exists, you need to register it in the Manifest file. Here, BIND_COMPLICATION_PROVIDER is necessary to ensure only the Wear OS system can bind to your service. To learn more, refer to Manifest declarations and permissions.
      In the AndroidManifest.xml file, register the service by adding the <service> tag inside the <application> tag: <service android:name=".complication.HydrationComplicationService" android:exported="true" android:icon="@drawable/drinking_water_icon" android:label="Hydration Tracker Complication" android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> </service> Inside the <service> tag, add the <intent-filter> tag. This lets the system know that your service is built on either ComplicationDataSourceService or the SuspendingComplicationDataSourceService, and is capable of providing data for watch face complications. <intent-filter> <action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> </intent-filter> Add the <meta-data> tag to specify the type of complication your service supports. In our case, it is set to RANGED_VALUE. <meta-data android:name="android.support.wearable.complications.SUPPORTED_TYPES" android:value="RANGED_VALUE" /> Include another <meta-data> tag, which defines how frequently the system should request updates from your data source while it is active. Since you will be updating manually, the value is set to zero. <meta-data android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" android:value="0" /> NoteIf you want to update the data periodically, you must use an UPDATE_PERIOD_SECONDS value of at least 300 seconds. For more details, refer to Metadata elements. Update the Data on Demand
      You can now install the complication and see how it works. However, the complication does not yet update each time we change the data. To make sure the complication is always showing up-to-date data:
      Create a method below the MainActivity, named requestComplicationUpdate(). private fun requestComplicationUpdate(context: Context) { val component = ComponentName(context, HydrationComplicationService::class.java) ComplicationDataSourceUpdateRequester .create(context, component) .requestUpdateAll() } Call the requestComplicationUpdate() method from the updateCount() and updateMaxGlasses() methods in the MainActivity. fun updateCount(newCount: Int) { glassCount = newCount prefs.edit() { putInt(countKey, newCount) } requestComplicationUpdate(context) } fun updateMaxGlasses(newMax: Int) { maxGlasses = newMax prefs.edit() { putInt(maxKey, newMax) } if (glassCount > newMax) updateCount(newMax) requestComplicationUpdate(context) } NoteHere, the updateCount() method updates how many glasses of water you have had. The updateMaxGlasses() method updates your goal. Your project is now complete! If you run into any issues, feel free to check out the completed version for reference:
      completed_project_complication.zip
      Test the Complication
      Tap and hold the watch face you currently have. Tap Customize.

      Figure 6: Customize the watch face



      Now swipe to the option that says Complication. Choose a slot that supports a ranged value.

      Figure 7: Swipe to Complication



      You see a list of applications that can provide data to that slot. Scroll down to see the complication you just created, named Hydration Tracker Complication, and select it.

      Figure 8: Choose the complication



      Swipe back to the watch face to see your complication in action.

      Figure 9: Preview



      NoteThe watch face must have a Complication Slot that supports ranged values. If your current watch face does not have one, apply a watch face that does and start from step 1. Conclusion
      Now that you’ve mastered the basics, don’t stop there! Explore different complication types, experiment with dynamic updates, and get creative with the kind of data your application can provide. The possibilities are wide open, and your next great idea might be just one complication away.
      If you have questions or need help with the information presented in this blog, you can share your queries on the Samsung Developers Forum. You can also contact us directly through the Samsung Developer Support Portal.
      View the full blog at its source
    • By Samsung Newsroom
      Advancements in medical research and technology are transforming the pharmaceutical industry by accelerating drug development, enabling personalized medicine, and enhancing patient care through AI, big data, and advanced diagnostics.
      Samsung Health collects and analyzes valuable health data from users’ daily activities. Using sensors in Galaxy smartphones and wearables, it tracks fitness activities, sleep cycles, nutrition, and more. When combined, this data offers a comprehensive, data-driven view of an individual’s overall health. When studied in depth, these insights can serve as a crucial resource for researchers, helping them better understand health conditions and explore how pharmaceutical interventions can improve wellness.
      One key area of study is sleep disturbances, a common and disruptive symptom among menopausal women. However, the causes of these disturbances remain insufficiently understood, and existing sleep aids often prove ineffective. To bridge this knowledge gap, Samsung Health has partnered with Bayer to conduct an observational study on sleep disturbances in menopausal women.
      With access to one of the world’s largest collections of biometric data from wearable devices, Samsung is uniquely positioned to enhance research in women's health with real-world evidence. By analyzing sleep patterns, heart rate variability, and overall well-being, Samsung Health can help Bayer gain deeper insights into women's health, enabling the development of targeted and meaningful treatment options at various life stages. This research aims to expand treatment options and improve sleep solutions for those experiencing menopause-related sleep issues.
      Technology plays a vital role in advancing clinical studies and medical research by providing real-time data and analytics from everyday activities, ultimately shaping better health outcomes.
      View the full blog at its source
    • Government UFO Files
    • By Shashank Suryavanshi
      Hi, I've developed the Tizen app using the web and now after building it, the build is created in wgt format.
      I want to install the build directly on Samsung Tv so that I can test the app there once.
      I've already created the certificates and it's also verified by the Tizen team.
      Now, when I tried to connect the SamsungTv with Tizen using the Device Manager I'm getting these following errors
      The remote device is already connected by another one. This remote device is running on a non-standard port or There is no IP address, please check the physical connection What I've done?
      I opened the developer mode of Samsung tv and updated the IP address with my system IP address and in the device manager I added all the details what was required and after clicking on add button then I faced the above errors.
      Can anyone help me like how can we either create the build in .tmg format because Usb demo packaging tool is not supported now.  Or how can I connect the SamsungTv with Tizen Studio using the Device Manager. 
      I've read and went through the documentation from official site still I face this issue.





×
×
  • Create New...