My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 12 attachment: Demo.java.patch (1.9 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Index: src/org/mixare/launcher/Demo.java
===================================================================
--- src/org/mixare/launcher/Demo.java (revision 22)
+++ src/org/mixare/launcher/Demo.java (working copy)
@@ -29,8 +29,11 @@
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
+import android.telephony.TelephonyManager;
+import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
@@ -90,7 +93,8 @@
{
//show the main screen
setContentView(R.layout.home);
-
+
+
//show the button that launch mixare
final Button berge = (Button) findViewById(R.id.Button);
berge.setOnClickListener(new View.OnClickListener() {
@@ -182,9 +186,27 @@
//show GPS settings
if( !getLocationManager().isProviderEnabled(android.location.LocationManager.GPS_PROVIDER ) )
{
- Toast.makeText( this, "Please turn on GPS", Toast.LENGTH_LONG ).show();
- Intent myIntent = new Intent( Settings.ACTION_SECURITY_SETTINGS );
- startActivity(myIntent);
+ Toast.makeText( this, "Please turn on GPS", Toast.LENGTH_LONG ).show();
+ //Output device name
+ Log.d("device", Build.DEVICE);
+ //Output model name of device (in this case only the firs 3 letters, which are "HTC")
+ Log.d("handy-model", Build.MODEL.substring(0, 3));
+
+ //only for HTC HERO
+ /*if(Build.DEVICE.equals("hero")){
+ Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS);
+ startActivity(myIntent);
+ }*/
+ //for HTC devices
+ if(Build.MODEL.substring(0, 3).equals("HTC")){
+ Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS);
+ startActivity(myIntent);
+ }
+ //for other devices
+ else{
+ Intent myIntent = new Intent( Settings.ACTION_SECURITY_SETTINGS );
+ startActivity(myIntent);
+ }
}
}

Powered by Google Project Hosting