Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
531
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
490f65a9
Commit
490f65a9
authored
9 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Add util methods for PlayServices & RemoteControl
parent
e6147284
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+19
-0
19 additions, 0 deletions
vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
with
19 additions
and
0 deletions
vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+
19
−
0
View file @
490f65a9
...
...
@@ -21,7 +21,9 @@
package
org.videolan.vlc.util
;
import
android.annotation.TargetApi
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.pm.PackageManager
;
import
android.net.ConnectivityManager
;
import
android.net.NetworkInfo
;
import
android.os.Build.VERSION
;
...
...
@@ -34,6 +36,7 @@ import android.view.MotionEvent;
import
org.videolan.libvlc.util.AndroidUtil
;
import
org.videolan.vlc.R
;
import
org.videolan.vlc.RemoteControlClientReceiver
;
import
org.videolan.vlc.VLCApplication
;
import
org.videolan.vlc.media.MediaWrapper
;
...
...
@@ -194,6 +197,14 @@ public class AndroidDevices {
return
0
;
}
public
static
boolean
hasPlayServices
()
{
try
{
VLCApplication
.
getAppContext
().
getPackageManager
().
getPackageInfo
(
"com.google.android.gsf"
,
PackageManager
.
GET_SERVICES
);
return
true
;
}
catch
(
PackageManager
.
NameNotFoundException
e
)
{}
return
false
;
}
public
static
boolean
hasLANConnection
()
{
boolean
networkEnabled
=
false
;
ConnectivityManager
connectivity
=
(
ConnectivityManager
)
(
VLCApplication
.
getAppContext
().
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
));
...
...
@@ -206,4 +217,12 @@ public class AndroidDevices {
}
return
networkEnabled
;
}
public
static
void
setRemoteControlReceiverEnabled
(
boolean
enabled
)
{
VLCApplication
.
getAppContext
().
getPackageManager
().
setComponentEnabledSetting
(
new
ComponentName
(
VLCApplication
.
getAppContext
(),
RemoteControlClientReceiver
.
class
),
enabled
?
PackageManager
.
COMPONENT_ENABLED_STATE_ENABLED
:
PackageManager
.
COMPONENT_ENABLED_STATE_DISABLED
,
PackageManager
.
DONT_KILL_APP
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment