Opening GDK Glassware through Mirror API Glassware MenuItem

后端 未结 2 936
灰色年华
灰色年华 2020-12-10 23:03

I have problem integrating GDK Glassware and Mirror API Glassware as described here. I need to open GDK glassware application using Mirroe api Glassware app MenuItem. Can I

2条回答
  •  盖世英雄少女心
    2020-12-10 23:40

    I have finally figured out a way to do that

    1. First add your custom scheme to android activity tag in AndroidManifest.xml

       
        
              
                  
                  
                  
              
              
                
                
                
              
              
          

    2. Then in Glassware timeline MenuItem add like following

      
      new MenuItem(){
      Action = "OPEN_URI",
      Payload = "com.sanath.scheme://open/Welcome/2014",
      Values = new MenuValue[]
              {
               new MenuValue()
               {
                  DisplayName  = "Open",
                  State = "DEFAULT"
               },
               new MenuValue()
               {
                  DisplayName  = "Launching",
                  State = "PENDING"
               },
               new MenuValue()
               {
                   DisplayName  = "Launched",
                   State = "CONFIRMED"
               },
               },
              },
          }
      

    3. Then inside your Activity OnCreate method you can get data as following

      
         Uri data = getIntent().getData();
              List params = data.getPathSegments();
              String param0 = params.get(0); // "welcome"
              String param1 = params.get(1); //"2014"

      String welcomeMsg = param0+" to "+param1; /*show time line card * */ Card welcomeCard =new Card(this); welcomeCard.setText(welcomeMsg); welcomeCard.setFootnote(param1); View view =welcomeCard.toView(); setContentView(view);

    Hope this will help others

提交回复
热议问题