Alex D.
Alex D.

Reputation: 1423

Android intent to viber user profile screen

I have an android app and I want to show viber user profile screen from my app. For this I use the following code:

                val uri = Uri.parse("tel:" + Uri.encode(userPhone))
                val intent = Intent("android.intent.action.VIEW")
                intent.setClassName("com.viber.voip", "com.viber.voip.WelcomeActivity")
                intent.data = uri
                startActivity(intent)

When Viber app is in background this code works fine, I see the profile screen of user with userPhone. But when Viber app is fully closed (it is not in recent applications) my code start only the main page of Viber, not the profile page. How to fix this bug?

Upvotes: 0

Views: 685

Answers (1)

Ausländer
Ausländer

Reputation: 499

this is C# version translate to java

this for contact number:

Intent intent = new Intent("android.intent.action.VIEW", 
Android.Net.Uri.Parse("viber://contact?number=contactnumber"));
 Context.StartActivity(intent);

this for public account chat:

 Intent intent = new Intent("android.intent.action.VIEW", 
 Android.Net.Uri.Parse("viber://pa?chatURI=publicaccounturi")); 
 Context.StartActivity(intent);

this for public account info page:

 Intent intent = new Intent("android.intent.action.VIEW", 
 Android.Net.Uri.Parse("viber://pa/info?uri=publicaccounturi"));
 Context.StartActivity(intent);

This will work even if viber is not running

Upvotes: 1

Related Questions