我有一个将在餐厅使用的Android应用程序,所以我希望用户无法退出应用程序.用户唯一可以使用的是应用程序.
(如果可能,只有管理员可以退出应用程序,登录或重启设备,我不知道哪种方式最好).
有没有解决方案或其他方法来做到这一点?
非常感谢你!
我正在使用新的Android Studio.我已经完成了一个应用程序并且工作正常,现在我要添加AdMob sdk.所以我将jar放在'libs'文件夹中,右键单击"add as library".我在智能手机上运行该项目,但应用程序在启动时崩溃.
我怎么解决这个问题?我认为导入AdMob sdk会有问题.
谢谢!
这是xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.application"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
//MY ACTIVITY
</activity>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<meta-data android:name="ADMOB_ALLOW_LOCATION_FOR_ADS" android:value="true"/>
<meta-data android:name="ADMOB_PUBLISHER_ID" android:value="a151964f48b17a7"/>
</application>
Run Code Online (Sandbox Code Playgroud)
这是布局xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
tools:context=".MainActivity">
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="MY_UNIT_ID"
ads:loadAdOnCreate="true" >
</com.google.ads.AdView>
Run Code Online (Sandbox Code Playgroud)
这是logcat
5-20 15:38:00.835 …Run Code Online (Sandbox Code Playgroud)