VjLxmi
VjLxmi

Reputation: 440

Youtube Player Android not working

I am using Youtube SDK for android. Trying to play video, It gives error "Connection to server lost. Tap to retry". So When I update youtube App, it plays the video. So Is there any method where I can check If old youtube Version is installed in the phone and notify users to update the App.

Upvotes: 0

Views: 127

Answers (1)

Aditya Vyas-Lakhan
Aditya Vyas-Lakhan

Reputation: 13555

AFAIK it is possible just try this packageinfo

https://developer.android.com/reference/android/content/pm/PackageInfo.html

public int versionCode 

// The version name of this package, as specified by the <manifest> tag's
// versionName attribute. Added in API level 1
public String versionName 

to get packageinfo

PackageInfo pinf = null;
pinf = getPackageManager().getPackageInfo("com.google.android.youtube", 0);
int versionNumber = pinf.versionCode;
String versionName = pinf.versionName;

Upvotes: 0

Related Questions