This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WeatherService { | |
private WeatherListener mListener; | |
public WeatherService(WeatherListener listener) { | |
this.mListener = listener; | |
} | |
public void getWeather(String cityName) { | |
RestAdapter adapter = new RestAdapter.Builder().setEndpoint("http://api.openweathermap.org").build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
productFlavors { | |
demo { | |
applicationId = "com.manijshrestha.weatherdemo.demo" | |
resValue "string", "app_name", "Demo App" | |
} | |
full { | |
applicationId = "com.manijshrestha.weatherdemo.full" | |
resValue "string", "app_name", "Full App" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void provisionOwner() { | |
DevicePolicyManager manager = | |
(DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); | |
ComponentName componentName = BasicDeviceAdminReceiver.getComponentName(this); | |
if(!manager.isAdminActive(componentName)) { | |
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); | |
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, componentName); | |
startActivityForResult(intent, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<receiver | |
android:name=".BasicDeviceAdminReceiver" | |
android:label="@string/admin_permission_label" | |
android:description="@string/admin_permission_description" | |
android:permission="android.permission.BIND_DEVICE_ADMIN"> | |
<meta-data android:name="android.app.device_admin" | |
android:resource="@xml/device_admin" /> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.manijshrestha.lollipopkiosk; | |
import android.app.admin.DeviceAdminReceiver; | |
import android.content.ComponentName; | |
import android.content.Context; | |
public class BasicDeviceAdminReceiver extends DeviceAdminReceiver { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> | |
<device-owner package="com.manijshrestha.lollipopkiosk" name="Task Pinning" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onPostCreate(Bundle bundle) { | |
super.onPostCreate(bundle); | |
getActionBar().hide(); | |
View decorView = getWindow().getDecorView(); | |
decorView.setSystemUiVisibility( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_kiosk); | |
mWebView = (WebView) findViewById(R.id.web_content); | |
mWebView.getSettings().setJavaScriptEnabled(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" | |
tools:context=".KioskActivity"> | |
<WebView | |
android:id="@+id/web_content" | |
android:layout_width="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.manijshrestha.lollipopkiosk"> | |
... | |
<uses-permission android:name="android.permission.INTERNET" /> | |
... | |
</manifest> |